package com.example.demo.util;

import cn.hutool.core.lang.Console;

import java.util.Random;

/**
 * Description: 随机字母生成器<br/>
 *
 * @author <br/>;
 * @taskId <br/>
 * <br/>
 */
public class RandomGenerator {

    //生成随机数字和字母,
    public String getStringRandom(int length) {

        String val = "";
        Random random = new Random();

        //参数length，表示生成几位随机数
        for (int i = 0; i < length; i++) {
            val += (char) (random.nextInt(26) + 97);
        }
        return val;
    }

    public static void main(String[] args) {
        RandomGenerator test = new RandomGenerator();
        //测试
        System.out.println(test.getStringRandom(8));
        //        Console.log(rand);
        int i = 0;
        int a = i++;
        int b = ++a;
        int c = a + b;
        int d = (a == 1) ? b : c;
        Console.log(a + "d = " + d);
    }

}